package cn.xxm.ff.log.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * @author xxm
 * @create 2019-11-02 22:40
 */

@Data
@ConfigurationProperties(prefix = "log.desensitize.config")
public class LogDesensitizeProperties {

    /**
     * #脱敏全局开关，默认false
     */
    private Boolean closeSwitch = false;
    /**
     * #误杀开关，默认不误杀
     */
    private Boolean stringKillSwitch = false;
    /**
     * #脱敏包，不配置，默认全部脱敏
     */
    private String packages = "";
    /**
     * #脱敏策略
     */
    private String strategy = "json_improvement";

    /**
     * #脱敏字段处理策略
     * # cardNames 类型字段，保留前三后三
     */
    @ConfigurationProperties(prefix = "log.desensitize.retain")
    @Data
    class DesensitizeRetain{

        private String cardNames="3,3";
        private String idNoKeyNames="3,4";
        private String custKeyNames="3,3";
        private String phoneKeyNames="3,2";
        private String emailKeyNames="2,2";
        private String homeAddressKeys="3,3";
        private String otherKeyNames="0,0";

    }

    /**
     * #脱敏类型、字段
     */
    @ConfigurationProperties(prefix = "log.desensitize.type")
    @Data
    class DesensitizeType{
        private String cardNames = "cardNo";
        private String custKeyNames = "name";
        private String phoneKeyNames = "mobileNo";
        private String emailKeyNames = "email";
        private String idNoKeyNames = "idNo";
        private String homeAddressKeys = "address";
        private String otherKeyNames = "fileName";
    }


}
